﻿namespace A14_EX01_2
{
    using System;
    using System.Collections.Generic;
    using System.Text;

    public class Program
    {
        public static void Main()
        {
            PrintRhombus(5);
        }

        public static void PrintRhombus(uint i_sizeOfRhombus)
        {
            uint numOfLinesForHalfTriangle = i_sizeOfRhombus / 2;
            uint currentNumOfAsterisksToPrintInLine = 1;
            uint currentNumOfSpacesToPrintInLine = i_sizeOfRhombus / 2;
            StringBuilder outputToPrint = new StringBuilder();

            // for first triangle
            for (int i = 0; i < numOfLinesForHalfTriangle; i++)
            {
                // print spaces
                for (int j = 0; j < currentNumOfSpacesToPrintInLine; j++)
                {
                    outputToPrint.Append(' ');
                }

                // print asterisks
                for (int j = 0; j < currentNumOfAsterisksToPrintInLine; j++)
                {
                    outputToPrint.Append('*');
                }

                outputToPrint.AppendLine();
                currentNumOfSpacesToPrintInLine--;
                currentNumOfAsterisksToPrintInLine += 2;
            }

            // print full line
            for (int i = 0; i < i_sizeOfRhombus; i++)
            {
                outputToPrint.Append('*');
            }

            outputToPrint.AppendLine();
            currentNumOfSpacesToPrintInLine++;
            currentNumOfAsterisksToPrintInLine -= 2;

            // for second triangle
            for (int i = 0; i < numOfLinesForHalfTriangle; i++)
            {
                // print spaces
                for (int j = 0; j < currentNumOfSpacesToPrintInLine; j++)
                {
                    outputToPrint.Append(' ');
                }

                // print asterisks
                for (int j = 0; j < currentNumOfAsterisksToPrintInLine; j++)
                {
                    outputToPrint.Append('*');
                }

                outputToPrint.AppendLine();
                currentNumOfSpacesToPrintInLine++;
                currentNumOfAsterisksToPrintInLine -= 2; 
            }

            System.Console.WriteLine(outputToPrint);
        }
    }
}
